﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using yunbo.Model.BIW;
using yunbo.Model.SSM;
using yunbo.Repositorys.BIWRepositorys;
using yunbo.Repositorys.SSMRepositorys;

namespace yunbo.Controllers.BIWControllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class WMS_KCController : ControllerBase
    {
        WMS_KCRepository wms_kcRepository= new WMS_KCRepository();
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetWMS_KC")]
        public IActionResult GetWMS_KC(string code)
        {
            List<WMS_KC> wMS_KCs = wms_kcRepository.GetWMS_KC(code);
            return Ok(wMS_KCs);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <returns></returns>
        [HttpPut("UpdateWMS_KC")]
        public IActionResult UpdateWMS_KC(int id, int sl)
        {
            bool rs = wms_kcRepository.UpdateWMS_KC(id,sl)>0;
            return Ok(rs);
        }
        /// <summary>
        /// 修改数量
        /// </summary>
        /// <returns></returns>
        [HttpPut("UpdateWMS_KCSL")]
        public IActionResult UpdateWMS_KCSL(string code, int sl)
        {
            bool rs = wms_kcRepository.UpdateWMS_KCSL(code, sl) > 0;
            return Ok(rs);
        }
        /// <summary>
        /// 修改数量
        /// </summary>
        /// <returns></returns>
        [HttpPut("UpdateWMS_KCCXSL")]
        public IActionResult UpdateWMS_KCCXSL(string code, int sl)
        {
            bool rs = wms_kcRepository.UpdateWMS_KCCXSL(code, sl) > 0;
            return Ok(rs);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <returns></returns>
        [HttpPost("PostWMS_KC")]
        public IActionResult PostWMS_KC(TJWMS_KC tJWMS_KC)
        {
            bool rs = wms_kcRepository.PostWMS_KC(tJWMS_KC) >0;
            return Ok(rs);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetWMS_KCDHDL")]
        public IActionResult GetWMS_KCDHDL(string ck_code, string kq_code, string kw_code, string wl_code)
        {
            string rs = wms_kcRepository.GetWMS_KCDHDL(ck_code, kq_code, kw_code, wl_code);
            return Ok(rs);
        }
        /// <summary>
        /// 修改数量
        /// </summary>
        /// <returns></returns>
        [HttpPut("UpdateWMS_KCXGSL")]
        public IActionResult UpdateWMS_KCXGSL(string code, int sl)
        {
            bool rs = wms_kcRepository.UpdateWMS_KCXGSL(code, sl) > 0;
            return Ok(rs);
        }
        [HttpGet("GetLLCKWMS_KC")]
        public IActionResult GetLLCKWMS_KC(string code)
        {
            List< LLCKWMS_KC> lLCKWMS_KC = wms_kcRepository.GetLLCKWMS_KC(code);
            return Ok(lLCKWMS_KC);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetFYCXWMS_KC")]
        public IActionResult GetFYCXWMS_KC(int PageNumber, int PageSize, string code)
        {
            FYCXWMS_KC fYCXWMS_KC = wms_kcRepository.GetFYCXWMS_KC(PageNumber, PageSize, code);
            return Ok(fYCXWMS_KC);
        }
        /// <summary>
        /// 库存调整
        /// </summary>
        /// <returns></returns>
        [HttpPut("UpdateWMS_KCXGTZ")]
        public IActionResult UpdateWMS_KCXGTZ(int sl, string ckcode, string kqcode, string kwcode, string wlcode)
        {
            bool rs = wms_kcRepository.UpdateWMS_KCXGTZ(sl, ckcode, kqcode, kwcode, wlcode) > 0;
            return Ok(rs);
        }
         [HttpGet("GetWMS_KCCKDL")]
        public IActionResult GetWMS_KCCKDL(string ck_code, string wl_code)
        {
            WMS_KC rs = wms_kcRepository.GetWMS_KCCKDL(ck_code, wl_code);
            return Ok(rs);
        }
        [HttpGet("GetWMS_KCWL")]
        public IActionResult GetWMS_KCWL(string ck_code, string wl_code)
        {
            List<WMS_KC> wMS_KCs = wms_kcRepository.GetWMS_KCWL(ck_code, wl_code);
            return Ok(wMS_KCs);
        }
    }
}
